﻿
using System;
using System.Globalization;
using System.Windows.Data;

namespace Xcj.Mes.WholeLine.ZH.HG.Shell.Converter
{
    public class DataForegroundConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value == null)
                return "DarkGray";

            try
            {
                int result = int.Parse(value.ToString());
                switch (result)
                {
                    case 20:
                        return "Black";

                    case 11: // "不良"
                    case 13: // "超上限"
                    case 14: // "超下限";
                        return "Red";

                    case 12: // "重测"
                    default:
                        return "DarkGray";
                }
            }
            catch // "重测"
            {
            }

            return "DarkGray";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}